<?php
namespace app\modules\supplier\logic;
use app\modules\base\LogicBase;
use think\Db;
/**
* 
*/

class LoginLogic extends LogicBase
{
	
	public function index($_option=[]){


		$option = [
            'is_pages' => false,//是否分页查询
            'page_current' => 10,//分页查询时，当前页码
            'page_size' => 1,
            'keyword' => '',
            'order' => 'DESC',
            'sort' => 'member_id'
        ];

        if (is_array($_option)) {
        	if ($_option['is_pages']) {
        		$option['is_pages'] = $_option['is_pages']?true:false;
        	}

        }

        if ($option['is_pages']) {
        	$data['record_count'] = db::name('supplier')
                ->count();
            $data['page_size'] = $option['page_size'];
            $data['page_max'] = ceil($data['record_count'] / $option['page_size']);
            $data['page_current'] = $option['page_current'];
            $data['list'] = db::name('supplier')
		->page($option['page_current'], $option['page_size'])->
		select();
        }else{
        	$data['record_count'] = db::name('supplier')
                ->count();
            $data['page_size'] = $option['page_size'];
            $data['page_max'] = ceil($data['record_count'] / $option['page_size']);
            $data['page_current'] = $option['page_current'];
        	$data['list'] = db::name('supplier')
		->limit($option['page_size'])->
		select();
        }	

        // if (condition) {
        //     # code...
        // $this->_error[] = '3123123';
        // return false;
        // }

       

		return $data;
	}
}